<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
  <script>

    var obj = {
      name: "why", // configurable: true
      age: 18
    }

    Object.defineProperty(obj, "name", {
      configurable: false, // 告诉js引擎, obj对象的name属性不可以被删除
      enumerable: false, // 告诉js引擎, obj对象的name属性不可枚举(for in/Object.keys)
      writable: false, // 告诉js引擎, obj对象的name属性不写入(只读属性 readonly)
      value: "coderwhy" // 告诉js引擎, 返回这个value
    })

    delete obj.name
    console.log(obj)

    // 通过Object.defineProperty添加一个新的属性
    Object.defineProperty(obj, "address", {})
    delete obj.address
    console.log(obj)

    console.log(Object.keys(obj))

    obj.name = "kobe"
    console.log(obj.name)

  </script>

</body>
</html>